package com.springboot.astra.service.serviceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.springboot.astra.bean.Order;
import com.springboot.astra.mapper.OrderMapper;
import com.springboot.astra.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class OrderServiceImpl implements OrderService {
    @Autowired
    OrderMapper orderMapper;
    @Override
    public Order getOneByOrderId(Integer id) {
        return orderMapper.getOneByOrderId(id);
    }

    @Override
    public List<Order> getAllByUserId(Integer id) {
        return orderMapper.getAllByUserId(id);
    }

    @Override
    public void insertOrder(Order order) {
        orderMapper.insertOrder(order);
    }

    @Override
    public void updateOnrByOrderId(Order order) {
        orderMapper.updateOnrByOrderId(order);
    }

    @Override
    public void deleteOneByOrderId(Order order) {
        orderMapper.deleteOneByOrderId(order);
    }

    @Override
    public IPage<Order> getOrderPageVo(Page<Order> page, String query) {
        return orderMapper.getOrderPageVo(page,query);
    }

    @Override
    public IPage<Order> getMyOrder(Page<Order> page, Integer orderId) {
        return orderMapper.getMyOrder(page,orderId);
    }
}
